#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    int count=0;
    for (int i = 0; i < n; ++i) {
        int code;
        cin >> code;

        if (((code & 8) == 8) && ((code & 4) == 4)) {
            count++;
        }
    }
    cout << count << endl;
}